#include<iostream>
#include<cmath>
using namespace std;

using ll = long long;
bool check(ll& x)
{
    if (x == 1) return false;
    for (ll i = 2; i <= sqrt(x); i++)
    {
        if (x % i == 0) return false;
    }
    return true;
}

int main()
{
    int n; cin >> n;
    for (int i = 1; i <= n; i++)
    {
        ll x; cin >> x;
        if (check(x)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}